<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // \d 匹配数字0~9 相当于[0-9]
        var reg = /\d/;
        // \D 匹配非数字 相当于[^0-9]
        var reg1 = /\D/;
        // \w 匹配大小写字母、数字、下划线 相当于[A-Za-z0-9_]
        var reg2 = /\w/;
        // \W \w的反向匹配 相当于[^A-Za-z0-9_]
        var reg3 = /\W/;
        // \s 匹配任意空白字符、包括空格、制表符、换页符、换行符、回车符等
        var reg4 = /\s/;
        // \S 匹配非空白字符
        var reg5 = /\S/;
    </script>
</body>

</html>